package com.zzqstart.cateorder.utils;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * ClassName: ConstantPropertiesUtils
 * Package: com.zzqstart.cateorder.utils
 * Description:
 *
 * @Author zzqstart
 * @Create 2023-03-05 11:13
 * @Version 1.0
 */
@Component
@Data
public class ConstantPropertiesUtils implements InitializingBean {
    /**
     * #关联的公众号appid
     * weixin.pay.appid=wx74862e0dfcf69954
     * #商户号
     * weixin.pay.partner=1558950191
     * #商户key
     * weixin.pay.partnerkey=T6m9iK73b0kn9g5v426MKfHQH7X8rKwb
     * #回调地址
     * weixin.pay.notifyurl=http://guli.shop/api/order/weixinPay/weixinNotify
     **/
    @Value("${weixin.pay.appid}")
    private String appid;
    @Value("${weixin.pay.partner}")
    private String partner;
    @Value("${weixin.pay.partnerkey}")
    private String partnerkey;
    @Value("${weixin.pay.notifyurl}")
    private String notifyurl;
    @Value("${weixin.pay.spbill_create_ip}")
    private String spbillCreateIp;

    public static String APPID;
    public static String PARTNER;
    public static String PARTNER_KEY;
    public static String NOTIFY_URL;
    public static String SPBILL_CREATE_IP;

    @Override
    public void afterPropertiesSet() throws Exception {
        APPID = appid.trim();
        PARTNER = partner.trim();
        PARTNER_KEY = partnerkey.trim();
        NOTIFY_URL = notifyurl.trim();
        SPBILL_CREATE_IP = spbillCreateIp.trim();
    }
}
